home *** CD-ROM | disk | FTP | other *** search
/ PD ROM 1 / PD ROM Volume I - Macintosh Software from BMUG (1988).iso / Programming / Programming Tools / Turbo Pascal / Logweed / CVTLOG20.PAS next >
Encoding:
Pascal/Delphi Source File  |  1987-07-01  |  2.9 KB  |  101 lines  |  [TEXT/ttxt]

  1. Program ConVerTLog {2.0 to 3.1};
  2. Type
  3.   CommandString = string[50];
  4.   Datestring = string[8];
  5.   CommentString = string[12];
  6.   Filename = string[24];
  7.  
  8. LogRec20 = Record
  9.   r       : integer;        {record counter}
  10.   date    : Datestring;     {date}
  11.   time    : Datestring;     {time}
  12.   elapsed : Datestring;     {elapsed}
  13.   comment : CommandString;  {comment}
  14.   end;
  15.  
  16. LogRec31 = Record
  17.   usage   : char;           {usage type, i.e. business/personal}
  18.   date    : Datestring;     {start date}
  19.   time    : Datestring;     {start time}
  20.   elapsed : Datestring;     {elapsed time}
  21.   comment : CommentString;  {comment}
  22.   end;
  23.  
  24. Var
  25.   logfile20      : file of LogRec20;
  26.   logfile31      : file of LogRec31;
  27.   log_data20     : logrec20;
  28.   log_data31     : logrec31;
  29.   i              : integer;
  30.   ch             : char;
  31.  
  32. Const
  33.   logfile31name    : filename = 'TIME31.LOG';
  34.   logfile20name    : filename = 'TIME20.LOG';
  35.  
  36.  
  37.  
  38. Begin   {program}
  39.  
  40. lowvideo;
  41. writeln;
  42. writeln('This program will convert a LOG V 2.0 TIME.LOG file to a');
  43. writeln('LOG V 3.1 TIME.LOG file.  First you must rename the 2.0');
  44. writeln('TIME.LOG file to TIME20.LOG.  This program will then create');
  45. writeln('the file TIME31.LOG, which you must rename TIME.LOG in order');
  46. writeln('to use with the LOG program.  This may seem like a lot of');
  47. writeln('screwing around, but it''ll help prevent accidental file');
  48. writeln('overwrites. Besides... what do you expect for free?');
  49. writeln;
  50. writeln('If TIME20.LOG is in the current directory,');
  51. writeln('then press any key to continue, ^C to abort...');
  52. read(kbd,ch);
  53.  
  54.   Assign(logfile31,logfile31name);
  55.   Rewrite(logfile31);
  56.   Assign(logfile20,logfile20name);
  57.   reset(logfile20);
  58.  
  59.   for i:=0 to filesize(logfile20)-1 do
  60.   begin
  61.     seek(logfile20,i);
  62.     read(logfile20,log_data20);
  63.  
  64.     log_data31.date:= log_data20.date;
  65.     log_data31.time:= log_data20.time;
  66.     log_data31.elapsed:= log_data20.elapsed;
  67.  
  68.     writeln('Date   : ',log_data31.date);
  69.     writeln('Time   : ',log_data31.time);
  70.     writeln('Elapsed: ',log_data31.elapsed);
  71.     writeln;
  72.     writeln('Originally entered as:  ',log_data20.comment);
  73.     writeln('Shorten to "',copy(log_data20.comment,1,12),'"');
  74.     write('(Y/N?) ');
  75.     read(kbd,ch); writeln(upcase(ch));
  76.     if upcase(ch)='Y' then log_data31.comment:=
  77.       copy(log_data20.comment,1,12)
  78.     else
  79.       begin
  80.       writeln;
  81.       writeln('                        |<-------->|');
  82.       write('Enter new description: ');
  83.       readln(log_data20.comment);
  84.       end;
  85.     writeln;
  86.     write('Enter time category ("@" or "A" through "Z"): ');
  87.     repeat
  88.       read(kbd,ch);
  89.     until upcase(ch) in ['@','A'..'Z'];
  90.     writeln(upcase(ch));
  91.     writeln;
  92.     log_data31.usage := upcase(ch);
  93.     seek(logfile31,filesize(logfile31));
  94.     write(logfile31,log_data31);
  95.   end; {for}
  96.  
  97.   Close(logfile31);
  98.   Close(logfile20);
  99.  
  100. End.
  101.